// Prepare Figure 5 //


clear all
clear matrix
set more off

// Load Panel dataset
use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 12, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo
estimates store M12

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 18, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo
estimates store M18

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 24, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo
estimates store M24

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 30, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo
estimates store M30

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 36, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo
estimates store M36

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 42, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo 
estimates store M42

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 48, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo 
estimates store M48

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 54, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo 
estimates store M54

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 60, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
eststo 
estimates store M60

esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA42_panelA.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep N, fmt(%12.4fc %12.0fc)) ///
	   ti("Economic Shock and Peer Effects by Months in Armed Group") ///	  
	   replace	



	  
* Peer Effects
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 12, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo
estimates store M12

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 18, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo
estimates store M18

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 24, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo
estimates store M24

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 30, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo
estimates store M30

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 36, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo
estimates store M36

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 42, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo 
estimates store M42

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 48, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo 
estimates store M48

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 54, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo 
estimates store M54

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t if Nmonthsingroup >= 60, absorb(wartimenetwork year origmun c.time_t##i.region) vce(cluster wartimenetwork)
nlcom _b[mean_gold_shock_r]/(_b[gold_shock_r] + _b[mean_gold_shock_r]), post
eststo 
estimates store M60

	   
esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA42_panelB.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep N, fmt(%12.4fc %12.0fc)) ///
	   keep(_nl_1) ///
	   varlabels( _nl_1 "Peer Effect") ///
	   ti("Economic Shock and Peer Effects by Months in Armed Group") ///	  
	   replace	

